﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/Basic.Master" AutoEventWireup="true" CodeBehind="BottleAnalyseList.aspx.cs" Inherits="PMS.UI.PM.BottleAnalyseList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var height = $("#divTotal").height();
            var master = $("#master").height();
            var content = parseFloat(height) - parseFloat(master) - 30;
            $("#tbList").css("height", content);
        });
    </script>
    
    <script type="text/javascript">
        $(function () {
            $("#tbList").datagrid({
                url: '/Logic/PM/BottleAnalyseAjax.aspx?method=GetBottleAnalyseList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: false,
                pagination: true,
                queryParams: com.serializeSearchArray("form1"),
                rownumbers: true,
                idField: "ID",
                singleSelect: true,
                pageSize: 20,
                pageList: [20, 50, 100],
                striped: true,
               
                columns: [[
                    { field: 'ck', checkbox: true, width: 30 },
                    {
                        field: 'State', title: '气瓶状态', sortable: true, align: "center", width: 60,
                        formatter: function (value, row, index) {
                            return com.getArrayText(StaticCombo.BottleState, value)
                        }
                    },

                    {
                        field: 'SerialCode', title: '流水号', sortable: true, align: "center", width: 80
                    },
                     {
                         field: 'BottleCode', title: '气瓶编号', sortable: true, align: "center", width: 100
                     },
                     {
                         field: 'BottleVolume', title: '气瓶规格(L)', sortable: true, align: "center", width: 100
                     },
                     { field: 'ProductName', title: '产品名称', sortable: true, align: "center", width: 100 },
                    {
                        field: 'TechParams', title: '技术参数', sortable: false, align: "center", width: 200,
                        formatter: function (value, row, index) {
                            //鼠标放在文本处自动显示tooltip
                            return '<span title=' + value + '>' + value + '</span>';
                        }
                    },
                     { field: 'CompletedDate', title: '配气完成日期', sortable: true, align: "center", width: 120 },
                     {
                         field: 'ProdUserName', title: '配气师', sortable: false, align: "center", width: 60
                     },
                      {
                          field: 'AnalyseUserName', title: '分析人', sortable: false, align: "center", width: 60
                      },
                    {
                        field: 'AnalyseRes', title: '分析结论', sortable: false, align: "center", width: 60,
                        formatter: function (value, row, index) {
                            return com.getArrayText(StaticCombo.BottleAnalyseRes, value)
                        },
                        styler: function (value, row, index) {
                            if (value == "1") {
                                return 'color:red';
                            }
                        }
                    },
                    {
                        field: 'AnalyseDate', title: '分析日期', sortable: true, align: "center", width: 120
                    },
                    {
                        field: 'ProductOrderCode', title: '生产订单号 ', align: "center", width: 100
                    },

                  {
                      field: 'QuotationCode', title: '报价单号', align: "center", width: 100
                  },
                    {
                        field: 'Note', title: '备注', sortable: false, align: "center", width: 200
                    }
                ]],
                singleSelect: true,
                pageSize: 20,
                pageList: [20, 50, 100],
                striped: true,
                onDblClickRow: function (rowIndex, rowData) {
                    if (rowData.State == '0') {
                        com.message("information", "当前气瓶还未完成配气，无法进行分析");
                    }
                    else if (rowData.State == '1') {
                        var url = "/UI/PM/BottleAnalyseRes.aspx?action=edit&ID=" + rowData.ID;
                        top.wrapper.addTab("编辑分析结果", url)
                    }//分析完成状态，查看分析结果
                    else {
                        var url = "/UI/PM/BottleAnalyseRes.aspx?action=view&ID=" + rowData.ID;
                        top.wrapper.addTab("查看分析结果", url)
                    }
                }
            })
        })
    </script>
    <script type="text/javascript">

        //查询
        function funcSearch() {
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
        }

        //重置
        function funcReload() {
            $("#form1").form("reset");
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
        }

        //分析
        function funcAnalyse() {
            var row = $('#tbList').datagrid('getSelected');
            if (row) {
                if (row.State == '0') {
                    com.message("information", "当前气瓶还未完成配气，无法进行分析");
                }
                else if (row.State == '1') {
                    var url = "/UI/PM/BottleAnalyseRes.aspx?action=edit&ID=" + row.ID;
                    top.wrapper.addTab("编辑分析结果", url)
                }//分析完成状态，查看分析结果
                else {
                    var url = "/UI/PM/BottleAnalyseRes.aspx?action=view&ID=" + row.ID;
                    top.wrapper.addTab("查看分析结果", url)
                }
            } else {
                com.message("information", "请选中一行");
            }
        }

        //分析反审
        function funcRedoAnalyse() {
            var row = $('#tbList').datagrid('getSelected');
            if (row) {
                if (row.State != '2') {
                    com.message("error", "当前气瓶状态不是 [分析完成]，无法进行反审！");
                    return;
                }
                $.messager.confirm('提示', '反审后该气瓶的分析结果将全部重置，确认反审该分析结果吗？', function (r) {
                    if (r) {
                        com.ajax({
                            url: '/Logic/PM/BottleAnalyseAjax.aspx?method=RedoAnalyse',
                            data: { 'ID': row.ID },
                            success: function (data) {
                                com.message(data.state, data.msg);
                                $('#tbList').datagrid('reload');
                            }
                        });
                    }
                });
            } else {
                com.message("information", "请选中一行");
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="divTotal" style="height: 100%; width: 100%">
        <div id="master" class="container_16" style="height: auto">
            <form id="form1">
                <div class="grid_2 sealbl" style="width: 100px; margin-left: 10px">
                    气瓶编号 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="BottleCode" name="BottleCode" data-cp="co" />
                </div>
                <div class="grid_2 sealbl" style="text-align: right;">
                    气瓶状态 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" class="easyui-combobox" id="State" name="State" data-cp="=" data-options="valueField:'value',textField:'text',data:StaticCombo.BottleStateQuery,panelHeight:'auto'" />
                </div>
                <div class="grid_4 sealbl" style="width: 100px">
                    分析时间从年月:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="startAnalyseDate" name="startAnalyseDate" data-cp="str>=" class="easyui-datebox" />
                </div>
                <div class="grid_2 sealbl">
                    到年月:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="endAnalyseDate" name="endAnalyseDate" data-cp="str<=" class="easyui-datebox" />
                </div>
                <div class="clear"></div>
                <div class="grid_2 sealbl" style="width: 100px; margin-left: 10px">
                    生产单号 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="ProductOrderCode" name="ProductOrderCode" data-cp="co" />
                </div>
                <div class="grid_2 sealbl" style="text-align: right;">
                    报价单号 :
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="QuotationCode" name="QuotationCode" data-cp="co" />
                </div>
                <div class="grid_4 sealbl" style="width: 100px">
                    分析结论:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" class="easyui-combobox" id="AnalyseRes" name="AnalyseRes" data-cp="=" data-options="valueField:'value',textField:'text',data:StaticCombo.BottleAnalyseRes,panelHeight:'auto'" />
                </div>
                <div class="grid_4 sealbl" style="width: 100px">
                    气瓶规格:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text"  id="BottleVolume" name="BottleVolume" data-cp="="  />
                </div>
            </form>
        </div>
        <table id="tbList" title="分析结果信息表 " style="width: 100%">
        </table>

    </div>
</asp:Content>

